package com.wanghai.carwashing.core.service.impl;

import com.wanghai.carwashing.core.bean.APICallLog;
import com.wanghai.carwashing.core.dao.BaseDao;
import com.wanghai.carwashing.core.form.APICallLogForm;
import com.wanghai.carwashing.core.model.vo.BaseParamVo;
import com.wanghai.carwashing.core.model.vo.Pager;
import com.wanghai.carwashing.core.service.ApiCallLogService;
import org.springframework.stereotype.Service;

/**
 * ApiCallLogServiceImpl
 * @author 王海
 */
@Service
public class ApiCallLogServiceImpl extends BaseDao<APICallLog> implements  ApiCallLogService  {

    @Override
    public int addAPICallLog(APICallLog apiCallLog) {
        add(apiCallLog);
        int id = apiCallLog.getId();
        if(id==0){
            throw new IllegalStateException("添加API调用日志失败");
        }
        return id;
    }

    @Override
    public int delAPICallLog(APICallLogForm apiCallLogForm) {
        return  del(APICallLog.class, apiCallLogForm);
    }

    public Pager<APICallLog> findAPICallLogs(BaseParamVo paramVo) {
       return find(APICallLog.class, paramVo);
    }
}
